package com.lcy.demo;

import com.alibaba.dubbo.config.ProtocolConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by 娄存银 on 2017/4/6.
 */

public class DemoAction {
    private DemoService service;

    public void sayHello(){
        String msg = service.sayHello("demo");
        System.out.println(msg);
    }

    @Autowired
    public void setService(DemoService service) {
        this.service = service;
    }

    public static void main(String[] args){
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("consumer.xml");
        DemoAction action = (DemoAction) context.getBean("demoAction");
        action.sayHello();
        context.stop();
        System.out.printf("end");
    }
}
